# $Id: PKGBUILD 151540 2012-02-27 15:28:45Z pierre $
# Contributor: Jelle van der Waa <jelle vdwaa nl>

pkgname=mythes-nl
pkgver=20110104
pkgrel=2
pkgdesc="Dutch thesaurus"
arch=('any')
url="http://data.opentaal.org/opentaalbank/thesaurus/"
license=('BSD' 'custom:Creative Commons, Attribution 3.0 Unported')
optdepends=('libmythes: offers thesaurus library functions')
source=("http://data.opentaal.org/opentaalbank/thesaurus/download/thes_nl.oxt")
md5sums=('957d8589e6417f6e8185180a3a061aed')

package() {
  cd "${srcdir}"
  install -dm755 "${pkgdir}"/usr/share/mythes
  install -m644 th_nl_v2.dat "${pkgdir}/usr/share/mythes/th_nl_NL_v2.dat"
  install -m644 th_nl_v2.idx "${pkgdir}/usr/share/mythes/th_nl_NL_v2.idx"

  pushd "${pkgdir}/usr/share/mythes/"
  nl_NL_aliases="nl_AW nl_BE"
  for lang in $nl_NL_aliases; do
      ln -s th_nl_NL_v2.dat "th_"$lang"_v2.dat"
      ln -s th_nl_NL_v2.idx "th_"$lang"_v2.idx"
  done
  popd

  # the symlinks
  install -dm755 "${pkgdir}/usr/share/myspell/dicts"
  pushd "${pkgdir}/usr/share/myspell/dicts"
    for file in ${pkgdir}/usr/share/mythes/*; do
      ln -sv /usr/share/mythes/$(basename $file) .
    done
  popd

  # docs
  install -dm755 "${pkgdir}/usr/share/doc/${pkgname}"
  install -m644 README_th_nl.txt "${pkgdir}/usr/share/doc/${pkgname}"

  # licences
  install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -s ../../doc/${pkgname}/README_th_nl.txt $pkgdir/usr/share/licenses/$pkgname/README_th_nl.txt
}
